using System.Collections.Generic;
using System.IO;
using System.Text;

namespace ZerAx.TBON
{
    public class TbonInt : TbonObject
    {
        static TbonInt()
        {
            factories.Add(TbonType.Int, (s) => new TbonInt(s));
        }

        public override TbonType Type => TbonType.Int;

        public int val;

        public TbonInt(string name) : base(name) { }
        public TbonInt(string name, int val) : base(name)
        {
            this.val = val;
        }

        public override void ReadValue(BinaryReader reader)
        {
            val = reader.ReadInt32();
        }

        public override void WriteValue(BinaryWriter writer)
        {
            writer.Write(val);
        }

        public override string GetValueString() => val.ToString();
    }
}